package com.xclink.common.aspect;

import org.aspectj.lang.ProceedingJoinPoint;

public class AOPAdvice {
	public void beforeMethod(){
        System.out.println("beforeMethod");
    }

    //后置通知，在目标方法之后执行
    public void afterReturnMethod(){
        System.out.println("afterReturnMethod");
    }

    //最终通知，在目标方法执行完之后通知
    public void finallyMethod(){
        System.out.println("finallyMethod");
    }

    //异常通知
    public void afterThrowingMethod(){
        System.out.println("afterThrowingMethod");
    }

    //环绕通知，在目标方法前后执行
    public void aroundMethod(ProceedingJoinPoint pjp){
        System.out.println("aroundMethod1");
        try {
            pjp.proceed();
        } catch (Throwable e) {
            e.printStackTrace();
        }
        System.out.println("aroundMethod2");
    }
}
